package com.example.test.启动线程.可重入锁;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Loc {


    public static void main(String[] args) {
        Lock lock = new ReentrantLock();

        lock.lock();
        try {
            System.out.println("第一次打印");
            lock.lock();
            try {
                System.out.println("第二次打印");
            }finally {
                lock.unlock();
            }
        }finally {
            lock.unlock();
        }

    }

}
